package com.cssy.xxkj.logic.dao.impl;

import com.cssy.xxkj.logic.dao.LogicProductionReturnItemDAO;
import com.cssy.xxkj.logic.entity.LogicProductionReturnItemDO;
import com.plat.helper.SearchConditions;

import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

/**
 * 数据访问对象实现类
 * @since 2014-10-09
 */
public class LogicProductionReturnItemDAOImpl extends SqlMapClientDaoSupport implements LogicProductionReturnItemDAO {

    /**
     * 插入数据
     * @param logicProductionReturnItemDO
     * @return 插入数据的主键
     */
    public String insertLogicProductionReturnItemDO(LogicProductionReturnItemDO logicProductionReturnItemDO) throws DataAccessException {
        Object id = getSqlMapClientTemplate().insert("LogicProductionReturnItem.insert", logicProductionReturnItemDO);
        return (String) id;
    }

    /**
     * 统计记录数
     * @param logicProductionReturnItemDO
     * @return 查出的记录数
     */
    public Integer countLogicProductionReturnItemDOByExample(LogicProductionReturnItemDO logicProductionReturnItemDO) throws DataAccessException {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicProductionReturnItem.countByDOExample", logicProductionReturnItemDO);
        return count;
    }

    /**
     * 更新记录
     * @param logicProductionReturnItemDO
     * @return 受影响的行数
     */
    public Integer updateLogicProductionReturnItemDO(LogicProductionReturnItemDO logicProductionReturnItemDO) throws DataAccessException {
        int result = getSqlMapClientTemplate().update("LogicProductionReturnItem.update", logicProductionReturnItemDO);
        return result;
    }

    /**
     * 获取对象列表
     * @param logicProductionReturnItemDO
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<LogicProductionReturnItemDO> findListByExample(LogicProductionReturnItemDO logicProductionReturnItemDO) throws DataAccessException {
        List<LogicProductionReturnItemDO> list = getSqlMapClientTemplate().queryForList("LogicProductionReturnItem.findListByDO", logicProductionReturnItemDO);
        return list;
    }

    /**
     * 根据主键获取logicProductionReturnItemDO
     * @param id
     * @return logicProductionReturnItemDO
     */
    public LogicProductionReturnItemDO findLogicProductionReturnItemDOByPrimaryKey(String id) throws DataAccessException {
        LogicProductionReturnItemDO logicProductionReturnItemDO = (LogicProductionReturnItemDO) getSqlMapClientTemplate().queryForObject("LogicProductionReturnItem.findByPrimaryKey", id);
        return logicProductionReturnItemDO;
    }

    /**
     * 删除记录
     * @param id
     * @return 受影响的行数
     */
    public Integer deleteLogicProductionReturnItemDOByPrimaryKey(String id) throws DataAccessException {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicProductionReturnItem.deleteByPrimaryKey", id);
        return rows;
    }

	@Override
	public List<LogicProductionReturnItemDO> find(SearchConditions scs)
			throws DataAccessException {
		List<LogicProductionReturnItemDO> list = getSqlMapClientTemplate().queryForList("LogicProductionReturnItem_ex.find", scs);
        return list;
	}

	@Override
	public Integer count(SearchConditions scs) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicProductionReturnItem_ex.count", scs);
        return count;
	}

	@Override
	public Integer deleteBizRemoved(String id) throws DataAccessException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Integer deleteProById(String id) throws DataAccessException {
		Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicProductionReturnItem_ex.deleteProById", id);
        return rows;
	}

}